import type {
  BarSeriesOption,
  ECElementEvent as ECElementEventType,
  EChartsOption as EChartsOptionType,
  ECharts as EChartsType,
  ElementEvent,
  LineSeriesOption,
  PieSeriesOption,
} from 'echarts'
import type { LabelOption } from 'echarts/types/src/util/types'
import type { BarChart } from '../../components/bar_chart'
import type { LineChart } from '../../components/line_chart'
import type { PieChart } from '../../components/pie_chart'

/**
 * 图表系列配置
 */
export type ECharts = EChartsType
export type EChartsTypes = BarChart | PieChart | LineChart
export type ECElementEvent = ECElementEventType
export type EChartsElementEvent = ElementEvent
export type EChartsOption = EChartsOptionType
export type EchartsTitleOption = EChartsOption['title']
export type EchartsTitleTextStyle = LabelOption & {
  width?: number
}
export type EchartsBarSeriesOption = BarSeriesOption
export type EchartsLineSeriesOption = LineSeriesOption
export type EchartsPieSeriesOption = PieSeriesOption

/**
 * 饼图
 */
// 数据项配置
export interface PieChartDataConfig {
  name: string
  value: number
}
export type PieChartDataItem = PieChartDataConfig[]
